/*
 * @description: 
 * @Author: wzg
 * @Date: 2021-03-18 16:38:06
 * @LastEditTime: 2021-03-19 09:21:05
 */
/* 连接数据库 */
import Sequelize from 'sequelize';
import { mysqlConfig } from '../config/config.js';/* 配置文件 */

const sequelize = new Sequelize(mysqlConfig.database, mysqlConfig.username, mysqlConfig.password, {
  host: mysqlConfig.host,
  dialect: 'mysql',
  pool: {
    max: 5,
    min: 0,
    idle: 30000
  }
});
(async () => {
  await sequelize.authenticate();
  console.log("数据库连接成功！")
})()

export default sequelize;